package com.homegoods.orderinfodetail.item;

import android.databinding.BindingAdapter;
import android.text.TextUtils;

import com.homegoods.orderinfodetail.R;
import com.kedll.library.mvp.BaseItem;
import com.kedll.library.util.BindingUtil;

import cn.jzvd.Jzvd;
import cn.jzvd.JzvdStd;

/**
 * @author QiQi
 * @ClassName: ShopDetailVideoIntroItem
 * @date 2018/9/26
 * @description 店铺详情工厂介绍部分
 */
public class ShopDetailVideoIntroItem extends BaseItem<Object> {
    private String videoUrl;
    private String thumUrl;

    public ShopDetailVideoIntroItem() {
        super(null);
    }


    @BindingAdapter(value = {"videoUrl", "thumUrl"})
    public static void setVideoDataSource(JzvdStd jzvdStd, String videoUrl, String thumUrl) {
        if (TextUtils.isEmpty(videoUrl)) {
            return;
        }
        jzvdStd.setUp(videoUrl, "", Jzvd.SCREEN_WINDOW_LIST);
        BindingUtil.loadImageNoTransform(jzvdStd.thumbImageView, thumUrl, null, null);
    }

//    @Bindable
    public String getVideoUrl() {
        return videoUrl == null ? "" : videoUrl;
    }

    public void setVideoUrl(String videoUrl) {
        this.videoUrl = videoUrl;
//        notifyPropertyChanged(BR.videoUrl);
    }

//    @Bindable
    public String getThumUrl() {
        return thumUrl == null ? "" : thumUrl;
    }

    public void setThumUrl(String thumUrl) {
        this.thumUrl = thumUrl;
//        notifyPropertyChanged(BR.thumUrl);
    }

    @Override
    public int getLayout() {
        return R.layout.info_shop_video_intro;
    }
}
